package thinkingJava.chapter18;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;

public class BasicFileOutput {
	public static String chapter18Path = "D:\\CVSROOT\\JavaSE\\src\\thinkingJava\\chapter18\\";
	static String file = "BasicFileOutput.out";
	public static void main(String[] args) throws IOException {
		String filename = chapter18Path + "BasicFileOutput.java";
		BufferedReader br = new BufferedReader(
				new StringReader(BufferedInputFile.read(filename)));
		PrintWriter pw = new PrintWriter(
				new BufferedWriter(new FileWriter(file)));
		int lineCount = 1;
		String s;
		while ((s = br.readLine()) != null) {
			pw.println(lineCount++ + " : " + s);
		}
		pw.close();
		System.out.println(BufferedInputFile.read(file));
	}
}
